home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / flight-of-the-museum.swf / scripts / com / google / analytics / external / HTMLDOM.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  5.8 KB  |  228 lines

  1. package com.google.analytics.external
  2. {
  3.    import com.google.analytics.debug.DebugConfiguration;
  4.    
  5.    public class HTMLDOM extends JavascriptProxy
  6.    {
  7.       
  8.       public static var cache_properties_js:XML = <script>
  9.             <![CDATA[
  10.                     function()
  11.                     {
  12.                         var obj = {};
  13.                             obj.host         = document.location.host;
  14.                             obj.language     = navigator.language ? navigator.language : navigator.browserLanguage;
  15.                             obj.characterSet = document.characterSet ? document.characterSet : document.charset;
  16.                             obj.colorDepth   = window.screen.colorDepth;
  17.                             obj.location     = document.location.toString();
  18.                             obj.pathname     = document.location.pathname;
  19.                             obj.protocol     = document.location.protocol;
  20.                             obj.search       = document.location.search;
  21.                             obj.referrer     = document.referrer;
  22.                             obj.title        = document.title;
  23.                         
  24.                         return obj;
  25.                     }
  26.                 ]]>
  27.          </script>;
  28.        
  29.       
  30.       private var _referrer:String;
  31.       
  32.       private var _language:String;
  33.       
  34.       private var _host:String;
  35.       
  36.       private var _pathname:String;
  37.       
  38.       private var _location:String;
  39.       
  40.       private var _search:String;
  41.       
  42.       private var _characterSet:String;
  43.       
  44.       private var _title:String;
  45.       
  46.       private var _protocol:String;
  47.       
  48.       private var _colorDepth:String;
  49.       
  50.       public function HTMLDOM(debug:DebugConfiguration)
  51.       {
  52.          super(debug);
  53.       }
  54.       
  55.       public function get search() : String
  56.       {
  57.          if(_search)
  58.          {
  59.             return _search;
  60.          }
  61.          if(!isAvailable())
  62.          {
  63.             return null;
  64.          }
  65.          _search = getProperty("document.location.search");
  66.          return _search;
  67.       }
  68.       
  69.       public function get location() : String
  70.       {
  71.          if(_location)
  72.          {
  73.             return _location;
  74.          }
  75.          if(!isAvailable())
  76.          {
  77.             return null;
  78.          }
  79.          _location = getPropertyString("document.location");
  80.          return _location;
  81.       }
  82.       
  83.       public function get pathname() : String
  84.       {
  85.          if(_pathname)
  86.          {
  87.             return _pathname;
  88.          }
  89.          if(!isAvailable())
  90.          {
  91.             return null;
  92.          }
  93.          _pathname = getProperty("document.location.pathname");
  94.          return _pathname;
  95.       }
  96.       
  97.       public function cacheProperties() : void
  98.       {
  99.          if(!isAvailable())
  100.          {
  101.             return;
  102.          }
  103.          var obj:Object = call(cache_properties_js);
  104.          if(obj)
  105.          {
  106.             _host = obj.host;
  107.             _language = obj.language;
  108.             _characterSet = obj.characterSet;
  109.             _colorDepth = obj.colorDepth;
  110.             _location = obj.location;
  111.             _pathname = obj.pathname;
  112.             _protocol = obj.protocol;
  113.             _search = obj.search;
  114.             _referrer = obj.referrer;
  115.             _title = obj.title;
  116.          }
  117.       }
  118.       
  119.       public function get language() : String
  120.       {
  121.          if(_language)
  122.          {
  123.             return _language;
  124.          }
  125.          if(!isAvailable())
  126.          {
  127.             return null;
  128.          }
  129.          var lang:String = getProperty("navigator.language");
  130.          if(lang == null)
  131.          {
  132.             lang = getProperty("navigator.browserLanguage");
  133.          }
  134.          _language = lang;
  135.          return _language;
  136.       }
  137.       
  138.       public function get colorDepth() : String
  139.       {
  140.          if(_colorDepth)
  141.          {
  142.             return _colorDepth;
  143.          }
  144.          if(!isAvailable())
  145.          {
  146.             return null;
  147.          }
  148.          _colorDepth = getProperty("window.screen.colorDepth");
  149.          return _colorDepth;
  150.       }
  151.       
  152.       public function get referrer() : String
  153.       {
  154.          if(_referrer)
  155.          {
  156.             return _referrer;
  157.          }
  158.          if(!isAvailable())
  159.          {
  160.             return null;
  161.          }
  162.          _referrer = getProperty("document.referrer");
  163.          return _referrer;
  164.       }
  165.       
  166.       public function get protocol() : String
  167.       {
  168.          if(_protocol)
  169.          {
  170.             return _protocol;
  171.          }
  172.          if(!isAvailable())
  173.          {
  174.             return null;
  175.          }
  176.          _protocol = getProperty("document.location.protocol");
  177.          return _protocol;
  178.       }
  179.       
  180.       public function get host() : String
  181.       {
  182.          if(_host)
  183.          {
  184.             return _host;
  185.          }
  186.          if(!isAvailable())
  187.          {
  188.             return null;
  189.          }
  190.          _host = getProperty("document.location.host");
  191.          return _host;
  192.       }
  193.       
  194.       public function get characterSet() : String
  195.       {
  196.          if(_characterSet)
  197.          {
  198.             return _characterSet;
  199.          }
  200.          if(!isAvailable())
  201.          {
  202.             return null;
  203.          }
  204.          var cs:String = getProperty("document.characterSet");
  205.          if(cs == null)
  206.          {
  207.             cs = getProperty("document.charset");
  208.          }
  209.          _characterSet = cs;
  210.          return _characterSet;
  211.       }
  212.       
  213.       public function get title() : String
  214.       {
  215.          if(_title)
  216.          {
  217.             return _title;
  218.          }
  219.          if(!isAvailable())
  220.          {
  221.             return null;
  222.          }
  223.          _title = getProperty("document.title");
  224.          return _title;
  225.       }
  226.    }
  227. }
  228.